package com.xyh.web.context;

import javax.servlet.ServletContext;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;

public class ApplicationContext {
	public static final String ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE = ApplicationContext.class.getName() + ".ROOT";

	private final Set<String> componentClasses = new LinkedHashSet<>();
	private ApplicationContext parent;
	private ServletContext servletContext;

    public ApplicationContext() {
        System.out.println("构造容器");
    }

	public void register(String... componentClasses) {
		Collections.addAll(this.componentClasses, componentClasses);
	}

	public ApplicationContext getParent() {
		return parent;
	}

	public void setParent(ApplicationContext parent) {
		this.parent = parent;
	}

	public ServletContext getServletContext() {
		return servletContext;
	}

	public void setServletContext(ServletContext servletContext) {
		this.servletContext = servletContext;
	}

	public void refresh() {
		System.out.println("refresh");
	}
}
